/**
 * opcodes.h
 * Contains the definitions for all opcode-related functions and address
 * modes for the 65c816
 *
 * @author  Philippe Johnson
 */

#ifndef __OPCODES_H__
#define __OPCODES_H__

#include "common.h"

typedef void (*opcodeFunc)();

/** ADC - Add with carry **/
void adc69M();  void adc69m();
void adc6DM();  void adc6Dm();
void adc6FM();  void adc6Fm();
void adc65M();  void adc65m();
void adc72M();  void adc72m();
void adc67M();  void adc67m();
void adc7DMX(); void adc7DmX(); void adc7DMx(); void adc7Dmx();
void adc7FMX(); void adc7FmX(); void adc7FMx(); void adc7Fmx();
void adc79MX(); void adc79mX(); void adc79Mx(); void adc79mx();
void adc75MX(); void adc75mX(); void adc75Mx(); void adc75mx();
void adc61MX(); void adc61mX(); void adc61Mx(); void adc61mx();
void adc71MX(); void adc71mX(); void adc71Mx(); void adc71mx();
void adc77MX(); void adc77mX(); void adc77Mx(); void adc77mx();
void adc63M();  void adc63m();
void adc73MX(); void adc73mX(); void adc73Mx(); void adc73mx();

/* AND - And accumulator with memory */
void and29M();  void and29m();
void and2DM();  void and2Dm();
void and2FM();  void and2Fm();
void and25M();  void and25m();
void and32M();  void and32m();
void and27M();  void and27m();
void and3DMX(); void and3DmX(); void and3DMx(); void and3Dmx();
void and3FMX(); void and3FmX(); void and3FMx(); void and3Fmx();
void and39MX(); void and39mX(); void and39Mx(); void and39mx();
void and35MX(); void and35mX(); void and35Mx(); void and35mx();
void and21MX(); void and21mX(); void and21Mx(); void and21mx();
void and31MX(); void and31mX(); void and31Mx(); void and31mx();
void and37MX(); void and37mX(); void and37Mx(); void and37mx();
void and23M();  void and23m();
void and33MX(); void and33mX(); void and33Mx(); void and33mx();

/* ASL - Shift memory or accumulator left */
void asl0AM();  void asl0Am();
void asl0EM();  void asl0Em();
void asl06M();  void asl06m();
void asl1EMX(); void asl1EmX(); void asl1EMx(); void asl1Emx();
void asl16MX(); void asl16mX(); void asl16Mx(); void asl16mx();

/* BCC - Branch if carry clear */
void bcc90();

/* BCS - Branch if carry set */
void bcsB0();

/* BEQ - Branch if equal */
void beqF0();

/* BIT - Test memory bits against accumulator */
void bit89M();  void bit89m();
void bit2CM();  void bit2Cm();
void bit24M();  void bit24m();
void bit3CMX(); void bit3CmX(); void bit3CMx(); void bit3Cmx();
void bit34MX(); void bit34mX(); void bit34Mx(); void bit34mx();

/* BMI - Branch if minus */
void bmi30();

/* BNE - Branch if not equal */
void bneD0();

/* BPL - Branch if plus */
void bpl10();

/* BRA - Branch always */
void bra80();

/* BRK - Software break */
void brk00();

/* BRL - Branch always long */
void brl82();

/* BVC - Branch if overflow clear */
void bvc50();

/* BVS - Branch if overflow set */
void bvs70();

/* CLC - Clear carry flag */
void clc18();

/* CLD - Clear decimal mode flag */
void cldD8();

/* CLI - Clear interrupt disable flag */
void cli58();

/* CLV - Clear overflow flag */
void clvB8();

/* CMP - Compare accumulator with memory */
void cmpC9M();  void cmpC9m();
void cmpCDM();  void cmpCDm();
void cmpCFM();  void cmpCFm();
void cmpC5M();  void cmpC5m();
void cmpD2M();  void cmpD2m();
void cmpC7M();  void cmpC7m();
void cmpDDMX(); void cmpDDmX(); void cmpDDMx(); void cmpDDmx();
void cmpDFMX(); void cmpDFmX(); void cmpDFMx(); void cmpDFmx();
void cmpD9MX(); void cmpD9mX(); void cmpD9Mx(); void cmpD9mx();
void cmpD5MX(); void cmpD5mX(); void cmpD5Mx(); void cmpD5mx();
void cmpC1MX(); void cmpC1mX(); void cmpC1Mx(); void cmpC1mx();
void cmpD1MX(); void cmpD1mX(); void cmpD1Mx(); void cmpD1mx();
void cmpD7MX(); void cmpD7mX(); void cmpD7Mx(); void cmpD7mx();
void cmpC3M();  void cmpC3m();
void cmpD3MX(); void cmpD3mX(); void cmpD3Mx(); void cmpD3mx();

/* COP - Coprocessor enable */
void cop02();

/* CPX - Compare index register X with memory */
void cpxE0X(); void cpxE0x();
void cpxECX(); void cpxECx();
void cpxE4X(); void cpxE4x();

/* CPY - Compare index register Y with memory */
void cpyC0X(); void cpyC0x();
void cpyCCX(); void cpyCCx();
void cpyC4X(); void cpyC4x();

/* DEC - Decrement */
void dec3AM(); void dec3Am();
void decCEM(); void decCEm();
void decC6M(); void decC6m();
void decDEMX(); void decDEmX(); void decDEMx(); void decDEmx();
void decD6MX(); void decD6mX(); void decD6Mx(); void decD6mx();

/* DEX - Decrement index register X */
void dexCAX(); void dexCAx();

/* DEY - Decrement index register Y */
void dey88X(); void dey88x();

/* EOR - Exclusive or accumulator with memory */
void eor49M();  void eor49m();
void eor4DM();  void eor4Dm();
void eor4FM();  void eor4Fm();
void eor45M();  void eor45m();
void eor52M();  void eor52m();
void eor47M();  void eor47m();
void eor5DMX(); void eor5DmX(); void eor5DMx(); void eor5Dmx();
void eor5FMX(); void eor5FmX(); void eor5FMx(); void eor5Fmx();
void eor59MX(); void eor59mX(); void eor59Mx(); void eor59mx();
void eor55MX(); void eor55mX(); void eor55Mx(); void eor55mx();
void eor41MX(); void eor41mX(); void eor41Mx(); void eor41mx();
void eor51MX(); void eor51mX(); void eor51Mx(); void eor51mx();
void eor57MX(); void eor57mX(); void eor57Mx(); void eor57mx();
void eor43M();  void eor43m();
void eor53MX(); void eor53mX(); void eor53Mx(); void eor53mx();

/* INC - Increment */
void inc1AM();  void inc1Am();
void incEEM();  void incEEm();
void incE6M();  void incE6m();
void incFEMX(); void incFEmX(); void incFEMx(); void incFEmx();
void incF6MX(); void incF6mX(); void incF6Mx(); void incF6mx();

/* INX - Increment index register X */
void inxE8X(); void inxE8x();

/* INY - Increment index register Y */
void inyC8X(); void inyC8x();

/* JMP - Jump */
void jmp4C();
void jmp6C();
void jmp7CX(); void jmp7Cx();
void jmp5C();
void jmpDC();

/* JSR - Jump to subroutine */
void jsr20();
void jsrFCX(); void jsrFCx();
void jsr22();

/* LDA - Load accumulator from memory */
void ldaA9M();  void ldaA9m();
void ldaADM();  void ldaADm();
void ldaAFM();  void ldaAFm();
void ldaA5M();  void ldaA5m();
void ldaB2M();  void ldaB2m();
void ldaA7M();  void ldaA7m();
void ldaBDMX(); void ldaBDmX(); void ldaBDMx(); void ldaBDmx();
void ldaBFMX(); void ldaBFmX(); void ldaBFMx(); void ldaBFmx();
void ldaB9MX(); void ldaB9mX(); void ldaB9Mx(); void ldaB9mx();
void ldaB5MX(); void ldaB5mX(); void ldaB5Mx(); void ldaB5mx();
void ldaA1MX(); void ldaA1mX(); void ldaA1Mx(); void ldaA1mx();
void ldaB1MX(); void ldaB1mX(); void ldaB1Mx(); void ldaB1mx();
void ldaB7MX(); void ldaB7mX(); void ldaB7Mx(); void ldaB7mx();
void ldaA3M();  void ldaA3m();
void ldaB3MX(); void ldaB3mX(); void ldaB3Mx(); void ldaB3mx();

/* LDX - Load index register X from memory */
void ldxA2X(); void ldxA2x();
void ldxAEX(); void ldxAEx();
void ldxA6X(); void ldxA6x();
void ldxBEX(); void ldxBEx();
void ldxB6X(); void ldxB6x();

/* LDY - Load index register Y from memory */
void ldyA0X(); void ldyA0x();
void ldyACX(); void ldyACx();
void ldyA4X(); void ldyA4x();
void ldyBCX(); void ldyBCx();
void ldxB4X(); void ldxB4x();

/* LSR - Logical shift memory or accumulator right */
void lsr4AM();  void lsr4Am();
void lsr4EM();  void lsr4Em();
void lsr46M();  void lsr46m();
void lsr5EMX(); void lsr5EmX(); void lsr5EMx(); void lsr5Emx();
void lsr56MX(); void lsr56mX(); void lsr56Mx(); void lsr56mx();

/* MVN - Block move next */
void mvn54();

/* MVP - Block move previous */
void mvp44();

/* NOP - No operation */
void nopEA();

/* ORA - Or accumulator with memory */
void ora09M();  void ora09m();
void ora0DM();  void ora0Dm();
void ora0FM();  void ora0Fm();
void ora05M();  void ora05m();
void ora12M();  void ora12m();
void ora07M();  void ora07m();
void ora1DMX(); void ora1DmX(); void ora1DMx(); void ora1Dmx();
void ora1FMX(); void ora1FmX(); void ora1FMx(); void ora1Fmx();
void ora19MX(); void ora19mX(); void ora19Mx(); void ora19mx();
void ora15MX(); void ora15mX(); void ora15Mx(); void ora15mx();
void ora01MX(); void ora01mX(); void ora01Mx(); void ora01mx();
void ora11MX(); void ora11mX(); void ora11Mx(); void ora11mx();
void ora17MX(); void ora17mX(); void ora17Mx(); void ora17mx();
void ora03M();  void ora03m();
void ora13MX(); void ora13mX(); void ora13Mx(); void ora13mx();

/* PEA - Push effective absolute address */
void peaF4();

/* PEI - Push effective indirect address */
void peiD4();

/* PER - Push effective PC-relative indirect address */
void per62();

/* PHA - Push accumulator */
void pha48M(); void pha48m();

/* PHB - Push data bank register */
void phb8B();

/* PHD - Push direct page register */
void phd0B();

/* PHK - Push program bank register */
void phk4B();

/* PHP - Push processor status register */
void php08();

/* PHX - Push index register X */
void phxDAX(); void phxDAx();

/* PHY - Push index register Y */
void phy5AX(); void phy5Ax();

/* PLA - Pull accumulator */
void pla68M(); void pla68m();

/* PLB - Pull data bank register */
void plbAB();

/* PLD - Pull direct page register */
void pld2B();

/* PLP - Pull status flags */
void plp28();

/* PLX - Pull index register X from stack */
void plxFAX(); void plxFAx();

/* PLY - Pull index register Y from stack */
void ply7AX(); void ply7Ax();

/* REP - Reset status bits */
void repC2();

/* ROL - Rotate memory or accumulator left */
void rol2AM();  void rol2Am();
void rol2EM();  void rol2Em();
void rol26M();  void rol26m();
void rol3EMX(); void rol3EmX(); void rol3EMx(); void rol3Emx();
void rol36MX(); void rol36mX(); void rol36Mx(); void rol36mx();

/* ROR - Rotate memory or accumulator right */
void ror6AM();  void ror6Am();
void ror6EM();  void ror6Em();
void ror66M();  void ror66m();
void ror7EMX(); void ror7EmX(); void ror7EMx(); void ror7Emx();
void ror76MX(); void ror76mX(); void ror76Mx(); void ror76mx();

/* RTI - Return from interrupt */
void rti40();

/* RTL - Return from subroutine long */
void rtl6B();

/* RTS - Return from subroutine */
void rts60();

/* SBC - Subtract with borrow from accumulator */
void sbcE9M();  void sbcE9m();
void sbcEDM();  void sbcEDm();
void sbcEFM();  void sbcEFm();
void sbcE5M();  void sbcE5m();
void sbcF2M();  void sbcF2m();
void sbcE7M();  void sbcE7m();
void sbcFDMX(); void sbcFDmX(); void sbcFDMx(); void sbcFDmx();
void sbcFFMX(); void sbcFFmX(); void sbcFFMx(); void sbcFFmx();
void sbcF9MX(); void sbcF9mX(); void sbcF9Mx(); void sbcF9mx();
void sbcF5MX(); void sbcF5mX(); void sbcF5Mx(); void sbcF5mx();
void sbcE1MX(); void sbcE1mX(); void sbcE1Mx(); void sbcE1mx();
void sbcF1MX(); void sbcF1mX(); void sbcF1Mx(); void sbcF1mx();
void sbcF7MX(); void sbcF7mX(); void sbcF7Mx(); void sbcF7mx();
void sbcE3M();  void sbcE3m();
void sbcF3MX(); void sbcF3mX(); void sbcF3Mx(); void sbcF3mx();

/* SEC - Set carry flag */
void sec38();

/* SED - Set decimal mode flag */
void sedF8();

/* SEI - Set interrupt disable flag */
void sei78();

/* SEP - Set status bits */
void sepE2();

/* STA - Store accumulator to memory */
void sta8DM();  void sta8Dm();
void sta8FM();  void sta8Fm();
void sta85M();  void sta85m();
void sta92M();  void sta92m();
void sta87M();  void sta87m();
void sta9DMX(); void sta9DmX(); void sta9DMx(); void sta9Dmx();
void sta9FMX(); void sta9FmX(); void sta9FMx(); void sta9Fmx();
void sta99MX(); void sta99mX(); void sta99Mx(); void sta99mx();
void sta95MX(); void sta95mX(); void sta95Mx(); void sta95mx();
void sta81MX(); void sta81mX(); void sta81Mx(); void sta81mx();
void sta91MX(); void sta91mX(); void sta91Mx(); void sta91mx();
void sta97MX(); void sta97mX(); void sta97Mx(); void sta97mx();
void sta83M();  void sta83m();
void sta93MX(); void sta93mX(); void sta93Mx(); void sta93mx();

/* STP - Stop the processor */
void stpDB();

/* STX - Store index register X to memory */
void stx8EX(); void stx8Ex();
void stx86X(); void stx86x();
void stx96X(); void stx96x();

/* STY - Store index register Y to memory */
void sty8CX(); void sty8Cx();
void sty84X(); void sty84x();
void sty94X(); void sty94x();

/* STZ - Store zero to memory */
void stz9CM();  void stz9Cm();
void stz64M();  void stz64m();
void stz9EMX(); void stz9EmX(); void stz9EMx(); void stz9Emx();
void stz74MX(); void stz74mX(); void stz74Mx(); void stz74mx();

/* TAX - Transfer accumulator to index register X */
void taxAAX(); void taxAAx();

/* TAY - Transfer accumulator to index register Y */
void tayA8X(); void tayA8x();

/* TCD - Transfer 16-bit accumulator to direct page register */
void tcd5B();

/* TCS - Transfer accumulator to stack pointer */
void tcs1B();

/* TDC - Transfer direct page register to 16-bit accumulator */
void tdc7B();

/* TRB - Test and reset memory bits against accumulator */
void trb1CM(); void trb1Cm();
void trb14M(); void trb14m();

/* TSB - Test and set memory bits against accumulator */
void tsb0CM(); void tsb0Cm();
void tsb04M(); void tsb04m();

/* TSC - Transfer stack pointer to 16-bits accumulator */
void tsc3B();

/* TSX - Transfer stack pointer to index register X */
void tsxBAX(); void tsxBAx();

/* TXA - Transfer index register X to accumulator */
void txa8AM(); void txa8Am();

/* TXS - Transfer index register X to stack pointer */
void txs9AX(); void txs9Ax();

/* TXY - Transfer index register X to Y */
void txy9BX(); void txy9Bx();

/* TYA - Transfer index register Y to accumulator */
void tya98M(); void tya98m();

/* TYX - Transfer index register Y to X */
void tyxBBX(); void tyxBBx();

/* WAI - Wait for interrupt */
void waiCB();

/* WDM - Reserved for expansion; unused */
/* void wdm42(); */

/* XBA - Exchange the b and a accumulators */
void xbaEB();

/* XCE - Exchange carry and emulation bit */
void xceFB();

#endif /* __OPCODES_H__ */

